package com.yidu.mapper;

import com.yidu.entity.Menu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface MenuMapper {
    @Select("select * from (select rownum as rn,m.* from Menu m ) where 1=1  and rn between #{page} and #{limit}")
    public List<Menu> selectMenu(Map map);
    @Insert("insert into Menu values (#{menuId},#{parentMenuId},#{menuType},#{menuName},#{menuClass},#{menuUrl},#{menuTip})")
    public void insertMenu(Menu menu);
    @Update("update Menu set parentMenuId = #{parentMenuId},menuType = #{menuType} , menuName = #{menuName} , menuClass = #{menuClass},menuUrl = #{menuUrl} , menuTip = #{menuTip} where menuId = #{menuId}")
    public void updateMenu(Menu menu);
    @Delete("delete from Menu where menuId = #{menuId}")
    public void deleteMenu(int menuId);
}
